-
-
Notifications
You must be signed in to change notification settings - Fork 4k
Use RenderStartup
for bevy_solari
.
#19918
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
This PR is based off of #19912 so we don't have to restructure how we add render graph nodes. I will wait for that before sending it out for review. |
2b369a7
to
a770f7d
Compare
I really don't like this solution :/. It really complicates the solari code. Perhaps we could make a generic version of this that multiple plugins could use? |
@JMS55 I'm not sure I agree that this complicates the solari code significantly. The only part that isn't specific to solari code is I think the fact that we have to configure the system sets 3 times. I tried drafting this up and it's quite gross 0da4a59 In theory the To me, this seems like a lot of complexity that makes it less clear what's going on and why. Looking through our code, here are these cases with
Feel free to investigate, but the TL;DR for what these conditionals access is:
That's quite a mix of things we access, so it's not as simple as adding a run condition for features or something (plus I want to make the run conditions themselves as cheap as possible). |
To me this doesn't look particularly that complicated. It's a bit more setup code, but it also makes things more explicit which I think is valuable. I like the idea of a HasRequiredFeatures resource for a run condition. With that said, I'm not entirely sure the system sets is strictly needed? It's only used in a few places and it only exists for the purpose of the run condition but I feel like adding the run condition directly where it's needed might be more explicit and lead to overall a bit less code? We can always add back the system set in the future if we need more complex scheduling. |
// Making this a system that runs at RenderStartup allows a run condition to check for required | ||
// features first. | ||
fn add_solari_pathtracing_render_graph_nodes(world: &mut World) { | ||
world |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel like we should support the slightly nicer .add_render_graph_node directly on the RenderGraph and then query that. It's a bit weird to get the entire world just for that. It would be more explicit that way.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not to do in this PR to be clear, but as a follow up or before this PR merges it would be worth looking into it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point! I was definitely more focused on keeping the diff small. One advantage of this heavy-handed approach is we have to do significantly less error handling - all the error handling and logging is already in add_render_graph_node.
I'd be down to do that as a followup though.
/// are enabled. | ||
/// | ||
/// Now systems can do a cheap check for if the resource exists. | ||
fn check_solari_has_required_features(mut commands: Commands, render_device: Res<RenderDevice>) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm a bit confused where is this system actually added to RenderStartup?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I totally goofed haha. I added the system now!
a770f7d
to
fcdc082
Compare
Due to the refactors from |
Objective
Solution
SolariSystems
system set that all systems belong to.SolariSystems
to only execute systems if the resource is present.Testing
solari
example, and it still works.